package cn.pet.service.manage.service.impl;

import cn.pet.service.manage.entity.PetCart;
import cn.pet.service.manage.entity.vo.CartList;
import cn.pet.service.manage.mapper.PetCartMapper;
import cn.pet.service.manage.service.PetCartService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 购物车表 服务实现类
 * </p>
 *
 * @author 
 * @since 2023-02-11
 */
@Service
@Slf4j
public class PetCartServiceImpl extends ServiceImpl<PetCartMapper, PetCart> implements PetCartService {

    @Value("${pet.downloadUrl}")
    private String downloadUrl;
    @Override
    public List<CartList> getListByUserId(Integer userId) {
        List<CartList> cartLists = this.baseMapper.queryListByUserId(userId);
        for (CartList cartList : cartLists) {
            cartList.setPicture(downloadUrl+"/"+cartList.getGoodId());
        }
        log.debug("列表数据{}",cartLists);
        return cartLists;
    }
}
